import Vue from 'vue'
import Router from 'vue-router'
import Root from '@/components/login_registered/Root'
import Login from '@/components/login_registered/Login'
import Registered from '@/components/login_registered/Registered'
import ForgetPassword from '@/components/login_registered/ForgetPassword'
import Home from '@/components/Home'
import Welcome from '@/components/Welcome'
import WorkbenchHome from '@/components/views/WorkbenchHome'
import Workbench from '@/components/views/Workbench'
import CreateJoinOrganization from '@/components/views/CreateJoinOrganization'
import CreateOrganization from '@/components/views/CreateOrganization'
import JoinOrganization from '@/components/views/JoinOrganization'
import QueryResults from '@/components/views/QueryResults'
import Associated from '@/components/IPA/Associated'
import AddAccount from '@/components/IPA/AddAccount'
import AppListDetails from '@/components/IPA/AppListDetails'
import AppTabulation from '@/components/IPA/AppTabulation'
import IpaTabulation from '@/components/IPA/IpaTabulation'
import DesignPage from '@/components/design/DesignPage'
import BugPage from '@/components/bug/BugPage'
import AddApp from '@/components/IPA/AddApp'
import AddIpa from '@/components/IPA/AddIpa'
import AddDesign from '@/components/design/AddDesign'
import EnterpriseOrganization from '@/components/setting/EnterpriseOrganization'
import TeamManagement from '@/components/setting/TeamManagement'
import PersonalInformation from '@/components/setting/PersonalInformation'

Vue.use(Router)


export default new Router({
  routes: [
    {
      path: '/',
      name: 'home',
      component: Home
    },
    {
      path:'/',
      redirect:'/home'

    },
    {
      path:'/home',
      component:Home,

    },{
      path:'/login',
      component:Root,
      // redirect: '/login',
      children: [{
        path:'/login',
        component:Login
      },{
        path:'/registered',
        component:Registered
      },,{
        path:'/forgetPassword',
        component:ForgetPassword
      },{
        path:'/createJoinOrganization',
        component:CreateJoinOrganization
      },{
        path:'/createOrganization',
        component:CreateOrganization
      },{
        path:'/joinOrganization',
        component:JoinOrganization
      },{
        path:'/queryResults',
        component:QueryResults
      }

      ]
    },
    {
      path:'/workbenchHome',
      component:WorkbenchHome,
      redirect:'/welcome',
      children:[{
        path:'/welcome',
        component:Welcome
      },{
        path:'/workbench',
        component:Workbench
      },{
        path:'/associated/',
        component:Associated,
      },{
          path:'/addAccount',
          name:'AddAccount',
          component:AddAccount
      },{
        path:'/appTabulation',
        component:AppTabulation
      },{
        path:'/ipaTabulation',
        component:IpaTabulation
      },{
        path: '/designPage',
        component: DesignPage
      },{
        path: '/bugPage',
        component: BugPage
      },{
        path: '/addApp',
        component: AddApp
      },{
        path: '/appListDetails',
        component: AppListDetails

      },{
        path: '/addIpa',
        component: AddIpa
      },{
        path: '/addDesign',
        component: AddDesign
      },{
        path: '/enterpriseOrganization',
        component: EnterpriseOrganization
      },{
        path: '/teamManagement',
        component: TeamManagement
      },{
        path: '/personalInformation',
        component: PersonalInformation
      }

      ]
    }
    // {
    //   path: '/',
    //   redirect:'/login'
    // },
    // {
    //   path: '/',
    //   name: '/login',
    //   component: 'Login'
    // }
  ]
})
const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}
